def test():
    # list1 = [1, 2, 3, 4, 5]
    # list1.append(6)
    # list1.insert(2, 7)
    # list1.remove(6)
    # list1.pop(2)
    # del list1[0]
    # list1.sort(reverse=True)
    # list1[1] = 8
    # index = list1.index(8)
    # print(index)
    # for item in list1:
    #     print(item)
    # list2 = [7, 8, 9]
    # for item in list2:
    #     list1.append(item)
    # list3 = [10, 11, 12]
    # list1.extend(list3)
    # list4 = list1[2:5]
    # list1[2] = [13, 14]
    # list1.extend([13,14])
    # list1.insert(2, [13,14])
    # del list1[2]
    # list1.insert(2, 13)
    # list1.insert(3, 14)
    # print(list1)

    # my_list = [3, "abcd", 9, "ab", 7, "abc", 2, "abcde", 5, "elderberry"]
    # my_list.append('fig')
    # my_list.insert(1,'my')
    # my_list.remove('banana')
    # my_list[my_list.index(7)] = "grape"
    # print(my_list.index("cherry"))
    # for item in my_list:
        # print(item)
    # my_list.insert(my_list.index("cherry") + 1, "kiwi")
    # print(my_list[2])
    # print(my_list[-2])
    # print(my_list[2:7])
    # print(my_list[::-1])


    # # 提取所有字符串并排序（列表推导式）
    # strings = sorted([item for item in my_list if isinstance(item, str)])
    # # 重新构建列表，保持数字在原位
    # result = []
    # string_index = 0
    # for item in my_list:
    #     if isinstance(item, (int, float)):
    #         result.append(item)  # 数字保持原位
    #     else:
    #         result.append(strings[string_index])  # 按排序顺序放入字符串
    #         string_index += 1
    #
    # # 获取字符串的索引位置
    # string_indices = [i for i, item in enumerate(my_list) if isinstance(item, str)]
    # # 获取所有字符串并排序
    # strings = sorted([item for item in my_list if isinstance(item, str)])
    # # 将排序后的字符串放回原索引位置
    # result = my_list.copy()
    # for idx, string in zip(string_indices, strings):
    #     # zip() 的结果：
    #     # [(1, 'apple'), (3, 'banana'), (5, 'cherry')]
    #     result[idx] = string
    #
    # print("原始列表:", my_list)
    # print("处理后的列表:", result)


    # def number_to_word(number):
    #     """将数字转换为对应的英文单词"""
    #     num_to_word = {
    #         0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four',
    #         5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine',
    #         10: 'ten'
    #     }
    #     return num_to_word.get(number, str(number))
    # # 将数字替换为对应的字符串形式
    # for i in range(len(my_list)):
    #     if isinstance(my_list[i], int):
    #         my_list[i] = number_to_word(my_list[i])
    #
    # print(f"转换后的列表:\n{my_list}")


    list4 = []
    for i in range(1,101):
        if i % 2 == 0:
            list4.append(i)

    for i in range(len(list4)):
        list4[i] = list4[i] * list4[i]

    # 从后往前遍历列表
    for i in range(len(list4)-1, -1, -1):
        if list4[i] > 1000:
            list4.pop(i)
    #
    # # 使用列表推导式删除大于1000的数字
    # filtered_numbers = [num for num in list4 if num <= 1000]
    #
    # # 使用filter函数
    # filtered_numbers = list(filter(lambda x: x <= 1000, list4))

    list4.reverse()

    var = list4[0:10]
    print(var)

    print([num * 2 for num in list4])

    print(list4)


if __name__ == '__main__':
    test()





